finding solution of system of equations